﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DataLayer
{
    /// <summary>
    /// Manages operations on readings
    /// </summary>
    public class ReadingDL : BaseDL
    {
        public DataSet addReading(int userVehicleID,decimal odometer,decimal fuelAdded,decimal fuelPrice,decimal lattitude,decimal longitude)
        {
            this._storedProcedureName = "addReading";
            this._params = new SqlParameter[] { 
                                                new SqlParameter("@UserVehicleID",userVehicleID),
                                                new SqlParameter("@Odometer",odometer),
                                                new SqlParameter("@FuelAdded",fuelAdded),
                                                new SqlParameter("@FuelPrice",fuelPrice),
                                                new SqlParameter("@Lattitude",lattitude),
                                                new SqlParameter("@Longitude", longitude)
                                                
                                              };

            return this.getDataSet();
        }
        public DataSet getReadingsForUser(string userName)
        {
            this._storedProcedureName = "getReadingsByUserName";
            this._params = new SqlParameter[] { 
                                                new SqlParameter("@UserName",userName)
                                                
                                                
                                              };

            return this.getDataSet();
        }
        public DataSet getReadingsForUserByVehicle(int uservehicleId)
        {
            this._storedProcedureName = "getReadingsByUserNameByUserVehicleID";
            this._params = new SqlParameter[] { 
                                                 //new SqlParameter("@UserName",userName),
                                                 new SqlParameter("@UserVehicleID",uservehicleId),
                                                
                                              };

            return this.getDataSet();
        }
    }
}
